<?php

namespace mpend\modules\cms\models;

use Yii;
use common\models\cms\CmsChannel;

/**
 * 新闻中心面板
 *
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class DashboardLogic extends \common\logics\DashboardLogic {

    /**
     * @var array top pages
     */
    public $channels = [];

    /**
     * Set top pages
     * @inheritdoc
     */
    protected function setChannels() {
        $query = CmsChannel::find()->active(CmsChannel::STATUS_ACTIVE)->andWhere([
            'scope' => CmsChannel::SCOPE_HOME,
        ]);
        $query->orderBy([
            'listorder' => SORT_ASC,
            'recommend_at' => SORT_DESC,
        ]);
        $query->limit(6);
        return $query->all();
    }

}
